Crate smart_wallet
source · [−]Expand description
Multisig Solana wallet with Timelock capabilities.
This program can be used to allow a smart wallet to govern anything a regular [Pubkey] can govern. One can use the smart wallet as a BPF program upgrade authority, a mint authority, etc.
To use, one must first create a SmartWallet account, specifying two important parameters:
- Owners - the set of addresses that sign transactions for the smart wallet.
- Threshold - the number of signers required to execute a transaction.
- Minimum Delay - the minimum amount of time that must pass before a Transaction can be executed. If 0, this is ignored.
Once the SmartWallet account is created, one can create a Transaction account, specifying the parameters for a normal Solana instruction.
To sign, owners should invoke the smart_wallet::approve instruction, and finally, smart_wallet::execute_transaction, once enough (i.e. SmartWallet::threshold) of the owners have signed.
Modules
An Anchor generated module, providing a set of structs
mirroring the structs deriving Accounts
, where each field is
a Pubkey
. This is useful for specifying accounts for a client.
An Anchor generated module containing the program’s set of
instructions, where each method handler in the #[program]
mod is
associated with a struct defining the input arguments to the
method. These should be used directly, when one wants to serialize
Anchor instruction data, for example, when speciying
instructions on a client.
Goki smart wallet program.
Structs
Accounts for smart_wallet::approve.
Accounts for smart_wallet::set_owners and smart_wallet::change_threshold.
Accounts for smart_wallet::create_smart_wallet.
Accounts for smart_wallet::create_subaccount_info.
Accounts for smart_wallet::create_transaction.
Accounts for smart_wallet::execute_transaction.
A SmartWallet is a multisig wallet with Timelock capabilities.
An account which holds the data of a single TXInstruction. Creating this allows an owner-invoker to execute a transaction with a minimal transaction size.
Mapping of a Subaccount to its SmartWallet.
Account metadata used to define TXInstructions
Instruction.
A Transaction is a series of instructions that may be executed by a SmartWallet.
Emitted when a Transaction is approved.
Emitted when a Transaction is proposed.
Emitted when a Transaction is executed.
Emitted when a Transaction is unapproved.
Emitted when the threshold of a SmartWallet is changed.
Emitted when a SmartWallet is created.
Emitted when the owners of a SmartWallet are changed.
Enums
Program errors.
Type of Subaccount.
Constants
Default number of seconds until a transaction expires.
Maximum timelock delay.
Constant declaring that there is no ETA of the transaction.
Number of seconds in a day.
Statics
The static program ID
Functions
Confirms that a given pubkey is equivalent to the program ID
The Anchor codegen exposes a programming model where a user defines
a set of methods inside of a #[program]
module in a way similar
to writing RPC request handlers. The macro then generates a bunch of
code wrapping these user defined methods into something that can be
executed on Solana.
Safety
Returns the program ID
Type Definitions
Anchor generated Result to be used as the return type for the program.